<template>
    <div style="margin: 0 50px">
        <!--搜索-->
        <el-row>
            <el-col :span="24">
                <div class="search">
                    <el-form :inline="true" :model="searchData" @keydown.enter.native="onSearch">
<!--                        <el-form-item class="text" label="编号">-->
<!--                            <el-input-->
<!--                                    placeholder="请输入编号"-->
<!--                                    v-model="searchData.id"-->
<!--                                    size="small"-->
<!--                                    clearable>-->
<!--                            </el-input>-->
<!--                        </el-form-item>-->
                        <el-form-item class="text" label="题目">
                            <el-input
                                    placeholder="请输入题目"
                                    v-model="searchData.question"
                                    size="small"
                                    clearable>
                            </el-input>
                        </el-form-item>

                        <el-form-item class="text" label="题型">
                            <el-select v-model="searchData.type"
                                       placeholder="请选择题型"
                                       size="small">
                                <el-option
                                        v-for="item in questionType"
                                        :key="item.valueId"
                                        :label="item.valueName"
                                        :value="item.valueId">
                                </el-option>
                            </el-select>
                        </el-form-item>
                      <el-form-item class="text" label="科目">
                        <el-select v-model="searchData.type"
                                   placeholder="请选择科目"
                                   size="small">
                          <el-option
                              v-for="item in questionSubject"
                              :key="item.valueId"
                              :label="item.valueName"
                              :value="item.valueId">
                          </el-option>
                        </el-select>
                      </el-form-item>
                        <el-form-item class="text" label="关键字">
                            <el-input
                                    placeholder="请输入关键字"
                                    v-model="searchData.keyword"
                                    size="small"
                                    clearable>
                            </el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-button icon="el-icon-search" size="mini" type="primary" @click="onSearch">搜索</el-button>
                            <el-button icon="el-icon-refresh" size="mini" @click="onReset">重置</el-button>
                        </el-form-item>
                    </el-form>
                </div>
            </el-col>
        </el-row>
        <!--工具栏-->
        <el-row>
            <el-col :span="24">
                <div class="tools">
                    <el-button @click="handleAddBtn" size="mini" icon="el-icon-plus" type="primary">新增</el-button>
                    <el-button :disabled="editBtnDisable" size="mini" icon="el-icon-edit"
                               @click="handleEditBtn(null,{id:selected[0]})"
                               type="success">修改
                    </el-button>
                    <el-button :disabled="deleteBtnDisable" size="mini" icon="el-icon-delete"
                               @click="handleDeleteByIds(selected)"
                               type="danger">删除
                    </el-button>
                    <el-button size="mini"
                               icon="el-icon-upload"
                               type="info" @click="importDialogVisible=true">导入
                    </el-button>
                    <el-button :disabled="false" size="mini" icon="el-icon-refresh" @click="refresh">刷新
                    </el-button>
                </div>
            </el-col>
        </el-row>
        <!--表格-->
        <el-row>
            <el-col :span="24">
                <div style="width: auto;">
                    <el-table
                            :data="tableData"
                            row-key="id"
                            @selection-change="selectionChange"
                            stripe
                            border
                            style="width: 100%;">
                        <el-table-column
                                type="selection"
                                align="center"
                                width="50">
                        </el-table-column>
                        <el-table-column
                                prop="id"
                                sortable
                                label="编号"
                                align="center"
                                width="80">
                        </el-table-column>
                        <el-table-column
                                prop="question"
                                align="left"
                                label="题目">
                        </el-table-column>
                        <el-table-column
                                align="center"
                                label="题型">
                            <template slot-scope="scope">
                                <span
                                        v-for="item in questionType"
                                        :key="item.valueId"
                                        :label="item.valueName"
                                        :value="item.valueId"
                                        v-if="scope.row.type===item.valueId">
                                    {{item.valueName}}
                                </span>
                            </template>
                        </el-table-column>
                        <el-table-column
                            align="center"
                            label="科目">
                          <template slot-scope="scope">
                                <span
                                    v-for="item in questionSubject"
                                    v-if="scope.row.subject===item.id">
                                    {{item.subject}}
                                </span>
                          </template>
                        </el-table-column>
                        <el-table-column
                                prop="keyword"
                                align="left"
                                label="关键字">
                        </el-table-column>
                        <el-table-column label="操作" align="center">
                            <template slot-scope="scope">
                                <el-button
                                        size="mini"
                                        type="text"
                                        icon="el-icon-edit"
                                        @click="handleEditBtn(scope.$index, scope.row)">编辑
                                </el-button>
                                <el-button
                                        size="mini"
                                        type="text"
                                        icon="el-icon-delete"
                                        @click="handleDeleteBtn(scope.$index, scope.row)">删除
                                </el-button>
                            </template>
                        </el-table-column>
                    </el-table>
                    <div style="margin-top: 15px;text-align: right;">
                        <el-pagination
                                background
                                @size-change="handleSizeChange"
                                @current-change="handleCurrentChange"
                                :current-page="currentPage"
                                :page-sizes="[10,20,50,100, 200, 300, 400]"
                                :page-size="pageSize"
                                layout="total, sizes, prev, pager, next, jumper"
                                :total="total">
                        </el-pagination>
                    </div>
                </div>
            </el-col>
        </el-row>
        <!--   新增题目   -->
        <el-dialog
                :close-on-click-modal="false"
                fullscreen
                title="新增题目"
                :visible.sync="addDialogVisible" class="new-bank">
            <el-form :inline="false" :model="add"
                     label-position="right"
                     label-width="90px">
                <el-form-item class="text" label="题型">
                    <el-select v-model="add.type"
                               placeholder="请选择题型"
                               size="small">
                        <el-option
                                v-for="item in questionType"
                                :key="item.valueId"
                                :label="item.valueName"
                                :value="item.valueId">
                        </el-option>
                    </el-select>
                </el-form-item>

              <el-form-item class="text" label="科目">
                <el-select v-model="add.type"
                           placeholder="请选择科目"
                           size="small">
                  <el-option
                      v-for="item in questionSubject"
                      :key="item.valueId"
                      :label="item.valueName"
                      :value="item.valueId">
                  </el-option>
                </el-select>
              </el-form-item>

                <el-form-item class="text" label="关键字">
                    <el-input
                            placeholder="请输入关键字"
                            v-model="add.keyword"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>

                <el-form-item label="题目" :style="{width: '100%'}">
                    <el-input v-model="add.question" type="textarea" placeholder="请输入题目"
                              :autosize="{ minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
                </el-form-item>

                <el-form-item v-if="add.type===1" label="设置选项" :style="{width: '100%'}">
                    <el-input
                            placeholder="选项A"
                            v-model="add.questionOption.optionA"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项B"
                            v-model="add.questionOption.optionB"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项C"
                            v-model="add.questionOption.optionC"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项D"
                            v-model="add.questionOption.optionD"
                            size="small"
                            clearable>
                    </el-input>
                    <el-radio-group v-model="add.questionOption.rightKey">
                        <el-radio :label="add.questionOption.optionA">{{add.questionOption.optionA}}</el-radio>
                        <el-radio :label="add.questionOption.optionB">{{add.questionOption.optionB}}</el-radio>
                        <el-radio :label="add.questionOption.optionC">{{add.questionOption.optionC}}</el-radio>
                        <el-radio :label="add.questionOption.optionD">{{add.questionOption.optionD}}</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item v-if="add.type===2" label="设置选项" :style="{width: '100%'}">
                    <el-input
                            placeholder="选项A"
                            v-model="add.questionOption.optionA"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项B"
                            v-model="add.questionOption.optionB"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项C"
                            v-model="add.questionOption.optionC"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项D"
                            v-model="add.questionOption.optionD"
                            size="small"
                            clearable>
                    </el-input>
                    <el-checkbox @change="chooseA" :label="add.questionOption.optionA"></el-checkbox>
                    <el-checkbox @change="chooseB" :label="add.questionOption.optionB"></el-checkbox>
                    <el-checkbox @change="chooseC" :label="add.questionOption.optionC"></el-checkbox>
                    <el-checkbox @change="chooseD" :label="add.questionOption.optionD"></el-checkbox>
                </el-form-item>

                <el-form-item v-if="add.type===1||add.type===2" class="text" label="答案说明">
                    <el-input
                            placeholder="请输入答案说明"
                            v-model="add.questionOption.explain"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>
                <el-form-item v-if="add.type===3" label="答案" :style="{width: '100%'}">
                    <el-input v-model="add.questionFillBlank.answer" type="textarea" placeholder="请输入答案"
                              :autosize="{ minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
                </el-form-item>

                <el-form-item v-if="add.type===4" label="选项" :style="{width: '100%'}">
                    <el-radio-group v-model="add.questionJudgment.rightKey">
                        <el-radio label="T">对</el-radio>
                        <el-radio label="F">错</el-radio>
                    </el-radio-group>
                </el-form-item>
                <el-form-item v-if="add.type===4" class="text" label="答案说明">
                    <el-input
                            placeholder="请输入答案说明"
                            v-model="add.questionJudgment.explain"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>
            </el-form>

            <span slot="footer" class="dialog-footer">
    <el-button @click="addDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="handleAdd">确 定</el-button>
  </span>
        </el-dialog>
        <!--   编辑题目   -->
        <el-dialog
                fullscreen
                :close-on-click-modal="false"
                title="编辑题目"
                :visible.sync="editDialogVisible" class="new-bank">
            <el-form :inline="false" :model="edit"
                     label-position="right"
                     label-width="90px">
                <el-form-item class="text" label="题型">
                    <el-select
                            disabled
                            v-model="edit.type"
                            placeholder="请选择题型"
                            size="small">
                        <el-option
                                v-for="item in questionType"
                                :key="item.valueId"
                                :label="item.valueName"
                                :value="item.valueId">
                        </el-option>
                    </el-select>
                </el-form-item>
              <el-form-item class="text" label="科目">
                <el-select
                    disabled
                    v-model="edit.subject"
                    placeholder="请选择科目"
                    size="small">
                  <el-option
                      v-for="item in questionSubject"
                      :key="item.valueId"
                      :label="item.valueName"
                      :value="item.valueId">
                  </el-option>
                </el-select>
              </el-form-item>

                <el-form-item class="text" label="关键字">
                    <el-input
                            placeholder="请输入关键字"
                            v-model="edit.keyword"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>

                <el-form-item label="题目" :style="{width: '100%'}">
                    <el-input v-model="edit.question" type="textarea" placeholder="请输入题目"
                              :autosize="{ minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
                </el-form-item>


                <el-form-item v-if="edit.type===1" label="选项" :style="{width: '100%'}">
                    <el-input
                            placeholder="选项A"
                            v-model="edit.questionOption.optionA"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项B"
                            v-model="edit.questionOption.optionB"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项C"
                            v-model="edit.questionOption.optionC"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项D"
                            v-model="edit.questionOption.optionD"
                            size="small"
                            clearable>
                    </el-input>
                    <el-radio-group v-model="edit.questionOption.rightKey">
                        <el-radio :label="'a'">{{edit.questionOption.optionA}}</el-radio>
                        <el-radio :label="'b'">{{edit.questionOption.optionB}}</el-radio>
                        <el-radio :label="'c'">{{edit.questionOption.optionC}}</el-radio>
                        <el-radio :label="'d'">{{edit.questionOption.optionD}}</el-radio>
                    </el-radio-group>
                </el-form-item>

                <el-form-item v-if="edit.type===2" label="选项" :style="{width: '100%'}">
                    <el-input
                            placeholder="选项A"
                            v-model="edit.questionOption.optionA"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项B"
                            v-model="edit.questionOption.optionB"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项C"
                            v-model="edit.questionOption.optionC"
                            size="small"
                            clearable>
                    </el-input>
                    <el-input
                            placeholder="选项D"
                            v-model="edit.questionOption.optionD"
                            size="small"
                            clearable>
                    </el-input>
                    <el-checkbox :checked="edit.questionOption.rightKey.indexOf('a')!==-1" @change="chooseA"
                                 :label="edit.questionOption.optionA"></el-checkbox>
                    <el-checkbox :checked="edit.questionOption.rightKey.indexOf('b')!==-1" @change="chooseB"
                                 :label="edit.questionOption.optionB"></el-checkbox>
                    <el-checkbox :checked="edit.questionOption.rightKey.indexOf('c')!==-1" @change="chooseC"
                                 :label="edit.questionOption.optionC"></el-checkbox>
                    <el-checkbox :checked="edit.questionOption.rightKey.indexOf('d')!==-1" @change="chooseD"
                                 :label="edit.questionOption.optionD"></el-checkbox>
                </el-form-item>


                <el-form-item v-if="edit.questionFillBlank!=null&&edit.type===3" label="答案" :style="{width: '100%'}">
                    <el-input v-model="edit.questionFillBlank.answer" type="textarea" placeholder="请输入答案"
                              :autosize="{ minRows: 4, maxRows: 4}" :style="{width: '100%'}"></el-input>
                </el-form-item>

                <el-form-item v-if="edit.questionJudgment!=null" label="选项" :style="{width: '100%'}">
                    <el-radio-group v-model="edit.questionJudgment.rightKey">
                        <el-radio label="T">对</el-radio>
                        <el-radio label="F">错</el-radio>
                    </el-radio-group>
                </el-form-item>

                <el-form-item v-if="edit.type===1" class="text" label="答案说明">
                    <el-input
                            placeholder="请输入答案说明"
                            v-model="edit.questionOption.explain"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>
                <el-form-item v-if="edit.type===2" class="text" label="答案说明">
                    <el-input
                            placeholder="请输入答案说明"
                            v-model="edit.questionOption.explain"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>
                <el-form-item v-if="edit.type===4" class="text" label="答案说明">
                    <el-input
                            placeholder="请输入答案说明"
                            v-model="edit.questionJudgment.explain"
                            size="small"
                            clearable>
                    </el-input>
                </el-form-item>
            </el-form>
            <span slot="footer" class="dialog-footer">
    <el-button @click="editDialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="handleEdit">确 定</el-button>
  </span>
        </el-dialog>
        <!--   导入题目   -->
        <el-dialog
                width="400px"
                title="导入"
                :close-on-click-modal="false"
                :visible.sync="importDialogVisible">
            <el-upload
                    align="center"
                    class="upload-demo"
                    drag
                    :headers="{
                    'Authorization': token
                    }"
                    name="file"
                    :on-success="uploadSuccess"
                    :on-error="uploadError"
                    :action="uploadPath"
            >
                <i class="el-icon-upload"></i>
                <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
                <div class="el-upload__tip" slot="tip">
                    <div>
                        只能上传xls/xlsx文件!
                    </div>
                    <el-button type="text" size="mini" @click="getImportExcelHandle">导入模板下载</el-button>
                </div>
            </el-upload>
        </el-dialog>
    </div>
</template>

<script>
    import {onlyFormat} from "../../../../utils/date";

    import {queryByTypeCode, subjectDict} from "../../../../api/dictionary";
    import {
        addQuestion,
        deleteQuestionById, deleteQuestionByIds,
        getQuestionById,
        questionBankList,
        updateQuestion
    } from "../../../../api/questionBank";
    import {getApiPath, getToken} from "../../../../utils/common";
    import {getImportExcel} from "../../../../api/user";
    import fileDownload from "js-file-download";

    export default {
        data() {
            return {
                checkList: [],
                searchData: {
                    id: "",
                    type: "",
                    subject: "",
                    keyword: "",
                    question: "",
                },
                tableData: [],
                add: {
                    type: 1,
                    subject: 1,
                    keyword: "",
                    question: "",//题
                    questionOption: {
                        optionA: "选项A",
                        optionB: "选项B",
                        optionC: "选项C",
                        optionD: "选项D",
                        rightKey: "选项A",
                        explain: ""
                    },
                    questionFillBlank: {
                        answer: ""
                    },
                    questionJudgment: {
                        rightKey: "",
                        explain: ""
                    }
                },
                edit: {},
                total: 0,//总页数
                currentPage: 1,//当前页面
                pageSize: 10,//每页大小
                addDialogVisible: false,//显示添加模态框
                editDialogVisible: false,//显示修改模态框
                importDialogVisible: false,
                editBtnDisable: true,
                deleteBtnDisable: true,
                exportBtnDisable: true,
                exportBtnLoading: false,
                selected: [],
                arr: {},
                questionType: [],
                questionSubject: [],
                token: "",
                uploadPath: "",
            }
        },
        mounted() {
            this.initDict();
            this.getList()
            this.uploadInit()
        },
        methods: {
            uploadInit() {
                let api = getApiPath();
                this.token = getToken();
                this.uploadPath = api + 'questionBank/import'
            },
            //搜索
            async onSearch() {
                this.getList()
            },
            //搜索重置
            onReset() {
                this.searchData = {
                    id: "",
                    type: "",
                    subject: "",
                    keyword: "",
                    question: "",
                };
                this.refresh()
            },
            //添加按钮
            handleAddBtn() {
                this.add = {
                    type: 1,
                    subject: 1,
                    keyword: "",
                    question: "",
                    questionOption: {
                        optionA: "选项A",
                        optionB: "选项B",
                        optionC: "选项C",
                        optionD: "选项D",
                        rightKey: "选项A",
                        explain: ""
                    },
                    questionFillBlank: {
                        answer: ""
                    },
                    questionJudgment: {
                        rightKey: "",
                        explain: ""
                    }
                }
                this.addDialogVisible = true;
            },
            //刷新按钮
            refresh() {
                this.getList()
            },
            //编辑按钮
            async handleEditBtn(index, row) {
                let resp = await getQuestionById(row.id)
                this.edit = resp.data
                this.editDialogVisible = true
                if (this.edit.type === 2) {
                    let item = this.edit.questionOption.rightKey.split("");
                    item.forEach(i => {
                        this.arr[i] = i;
                    })
                }
            },
            //提交编辑
            async handleEdit() {
                if (this.edit.type === 2) {
                    if (Object.keys(this.arr).length <= 1) {
                        this.$message({
                            type: 'warning',
                            message: '多选题答案至少应该有两个'
                        });
                        return false;
                    }
                    this.edit.questionOption.rightKey = ""
                    Object.keys(this.arr).sort().forEach(item => {
                        this.edit.questionOption.rightKey += item
                    })
                }
                let resp = await updateQuestion(this.edit)
                if (resp.code === 200) {
                    this.$message({
                        type: 'success',
                        message: '修改成功!'
                    });
                    this.refresh()
                    this.editDialogVisible = false
                } else {
                    this.$message({
                        type: 'error',
                        message: '修改失败：' + resp.message
                    });
                }
            },
            //删除按钮
            handleDeleteBtn(index, row) {
                this.$confirm('是否确认删除题目编号为"' + row.id + '"的数据项??', '警告', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(async () => {
                    let resp = await deleteQuestionById(row.id)
                    if (resp.code === 200) {
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                        this.refresh();
                    } else {
                        this.$message({
                            type: 'error',
                            message: '删除失败！' + resp.message
                        });
                    }
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            handleDeleteByIds() {
                this.$confirm('是否确认删除题目编号为"' + this.selected + '"的数据项??', '警告', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(async () => {
                    let resp = await deleteQuestionByIds(this.selected);
                    if (resp.code === 200) {
                        this.$message({
                            type: 'success',
                            message: '删除成功!'
                        });
                        this.refresh();
                    } else {
                        this.$message({
                            type: 'error',
                            message: '删除失败：' + resp.message
                        });
                    }
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            //获取列表
            async getList() {
                let resp = await questionBankList(this.searchData, this.currentPage, this.pageSize);
                this.total = resp.data.total;
                this.tableData = resp.data.list;
            },
            //页数改变
            handleSizeChange(val) {
                this.pageSize = val
                this.refresh();

            },
            //翻页
            handleCurrentChange(val) {
                this.currentPage = val
                this.refresh();
            },

            async handleAdd() {
                if (this.add.type === 1) {
                    let value = this.add.questionOption.rightKey
                    if (this.add.questionOption.optionA === value) {
                        this.add.questionOption.rightKey = "a";
                    }
                    if (this.add.questionOption.optionB === value) {
                        this.add.questionOption.rightKey = "b";
                    }
                    if (this.add.questionOption.optionC === value) {
                        this.add.questionOption.rightKey = "c";
                    }
                    if (this.add.questionOption.optionD === value) {
                        this.add.questionOption.rightKey = "d";
                    }
                }
                if (this.add.type === 2) {
                    if (Object.keys(this.arr).length <= 1) {
                        this.$message({
                            type: 'warning',
                            message: '多选题答案至少应该有两个'
                        });
                        return false;
                    }
                    this.add.questionOption.rightKey = ""
                    Object.keys(this.arr).sort().forEach(item => {
                        this.add.questionOption.rightKey += item
                    })
                }
                let resp = await addQuestion(this.add)
                if (resp.code === 200) {
                    this.$message.success('添加成功')
                    this.refresh();
                    this.addDialogVisible = false
                } else {
                    this.$message.error("添加失败：" + resp.message)
                }
            },
            selectionChange(selection) {
                if (selection.length === 0) {
                    this.editBtnDisable = true;
                    this.deleteBtnDisable = true;
                    this.exportBtnDisable = true;
                    this.selected.length = 0
                }

                if (selection.length > 0) {
                    this.deleteBtnDisable = false;
                    this.exportBtnDisable = false;
                    this.editBtnDisable = true;

                    this.selected.length = 0;
                    selection.forEach(item => {
                        this.selected.push(item.id)
                    })
                }
                if (selection.length === 1) {
                    this.editBtnDisable = false;
                }
            },
            async exportRole() {

            },
            //解析时间
            parseDate(time) {
                return onlyFormat(time);
            },
            async initDict() {
                let resp = await queryByTypeCode("question_type")
                this.questionType = resp.data

                let response=await subjectDict()
                this.questionSubject=response.data;
            },
            chooseA(selected) {
                if (selected) {
                    this.arr['a'] = 'a';
                } else {
                    delete this.arr['a']
                }
            },
            chooseB(selected) {
                if (selected) {
                    this.arr['b'] = 'b';
                } else {
                    delete this.arr['b']
                }
            },
            chooseC(selected) {
                if (selected) {
                    this.arr['c'] = 'c';
                } else {
                    delete this.arr['c']
                }
            },
            chooseD(selected) {
                if (selected) {
                    this.arr['d'] = 'd';
                } else {
                    delete this.arr['d']
                }
            },
            uploadSuccess(resp) {
                if (resp.code === 200) {
                    if (resp.data.success > 0) {
                        this.$message.success(resp.data.success + "条数据导入成功！")
                        this.getUserList();
                    } else {
                        this.$message.info("导入失败")
                    }
                } else {
                    this.$message.error('导入失败')
                }
            },
            uploadError(e) {
                this.$message.error('导入失败')
            },
          async getImportExcelHandle() {
            let data = await getImportExcel()
            fileDownload(data, "题库信息导入模板.xls");
          }

        }
    }
</script>
<style scoped lang="scss">
    .demo-table-expand {
        margin: 0 auto;

        .el-form-item {
            width: 45%;
            text-align: left;
            margin: 0;

        }
    }
    .new-bank{
      width: 60%;
      height: 80%;
      margin: 120px 0 0 360px;
    }

</style>
